WEBSERVER_COMPILE_DIR ?= $(error WEBSERVER_COMPILE_DIR environment variable is not set)
WEBSERVER_INSTALL_DIR ?= $(error WEBSERVER_INSTALL_DIR environment variable is not set)

APR_UTIL_SOURCE = apr-util-1.6.3.tar.bz2
APR_UTIL_DIR = apr-util-1.6.3

.PHONY: all
all: compile install

.PHONY: compile
compile: extract
	cd $(WEBSERVER_COMPILE_DIR)/$(APR_UTIL_DIR) && \
	./configure --prefix=$(WEBSERVER_INSTALL_DIR) --with-apr=$(WEBSERVER_INSTALL_DIR) && \
	make

.PHONY: extract
extract:
	tar -xjf $(APR_UTIL_SOURCE) -C $(WEBSERVER_COMPILE_DIR)

.PHONY: install
install:
	cd $(WEBSERVER_COMPILE_DIR)/$(APR_UTIL_DIR) && \
	make install